package com.wifi.channel.service;

import com.wifi.channel.dao.ChannelDao;
import com.wifi.channel.dao.ChannelDaoImpl;
import com.wifi.channel.entity.Channel;

import java.sql.SQLException;
import java.util.List;

public class ChannelServiceImpl implements ChannelService{
    ChannelDao channelDao=new ChannelDaoImpl();
    @Override
    public List<Object> getChannel(Integer start, Integer pageSize, String class1id, String class2id, String title) {
        try {
            return channelDao.queryChannel(start,pageSize,class1id,class2id,title);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }return null;
    }

    @Override
    public long selectCount(String class1id, String class2id, String title) {
        try {
            return channelDao.selectCount(class1id,class2id,title);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }return 0;
    }

    @Override
    public List<Object> getchannelClass1() {
        try {
            return channelDao.queryChannelClass1();
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }return null;
    }

    @Override
    public List<Object> getchannelClass2(String pid) {
        try {
            return channelDao.queryChannelClass2(pid);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }return null;
    }

    @Override
    public Object getchannelByid(Integer id) {
        try {
            return channelDao.getCbyId(id);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }return null;
    }

    @Override
    public int setDel(Integer valueOf, int i) {
        try {
            return channelDao.updateDel(valueOf,i);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }return 0;
    }

    @Override
    public Integer editUrl(String link, String id) {
        try {
            return channelDao.updateUrl(link,id);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }return 0;
    }

    @Override
    public Object ConfirmChannel(String name, Integer class1, Integer class2) {
        try {
            return channelDao.confirmChannel(name,class1,class2);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }return null;
    }

    @Override
    public Long add(Channel channel) {
        try {
            return channelDao.insert(channel);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }return Long.valueOf(0);
    }
}
